<template>
  <div>
    <div>{{namedefault}}</div>
    <child-one></child-one>
    <button @click="changeName">点击改变</button>
    <div v-on:click='f1' >
      <div v-on:click.right.prevent="f2">asdasdasdasdasdasdasdasdasd</div>
    </div>
    <div v-on:scroll="onScroll" style="width:40px;height:60px;word-break:break-all;overflow-y: scroll">点击改变点击改变点击改变点击改变点击改变点击改变</div>
  </div>
</template>
<script>
import childOne from '~/components/test1'
export default {
  layout: 'common',
  head: {
    title: '首页'
  },
  components: {
    childOne
  },
  provide () {
    return {
      name: this.namedefault,
      child: this.tochild
    }
  },

  data () {
    return {
      namedefault: 123
    }
  },
  mounted () {
    console.log(this)
  },
  methods: {
    changeName () {
      this._provided.name = this.namedefault = Math.random()
    },
    onScroll () {
      alert(1)
      console.log(123)
    },
    f1 () {
      alert(1)
    },
    f2 () {
      alert(2)
    },
    tochild () {

    }
  }
}
</script>
